<table>
	<thead>
		<tr>
			<th>序号</th>
			<volist name="listKey" id="vo">
				<th>{$vo}</th>
			</volist>
			 <th>操作</th> 
		</tr>
	</thead>
	<tbody>
		<volist name="_list" id="lv" key="vo">
		<tr>
			<td>{$lv.pid}</td>
			<volist name="listKey" id="lk" >
				<td>
					<switch name="key" >
<case value="name">{$lv.$key}</case>
<case value="describe"><input type="text" value="{$lv.$key}" style="width:500px" /></case>
<case value="url"><input type="text" value="{$lv.$key}" /></case>

</switch>

					<!--
					<input type="text" value="{$lv.$key}" />
					-->
					
					</td>
			</volist>
			<td>
				 <a class="update" href="javascript:;" data-id="{$lv.pid}">更新</a> 
			</td>
		</tr>
		</volist>
	</tbody>
</table>
<script type="text/javascript">
	 var ajaxUrl = "{:addons_url('ImgCarousel://ImgCarousel/updateImgInfo')}";
	
	$(function(){
		$('a.update').click(function(){
			
			var inputs = $(this).parents('tr').find('input');
			
			
			var id = $(this).data('id'); //data() 获得被选元素的 data-id数据
			
			//alert(ajaxUrl);
			//alert(inputs[2].value);
			
			
			 //执行ajax请求
            $.ajax({
                type: "POST",
                url: ajaxUrl,
                 data: "pid="+id+"&describe="+inputs[0].value+"&url="+inputs[1].value,
                success: function(msg){
					
					alert(msg);
					
					
                    
                },
                error: function(){
                    alert("服务器异步请求失败");
					location.reload();
                }
            });
			
			
			
		});
	})
</script>
